<template>
	<view class="" style="width: 100vw;height: 100vh">
	<!-- <view  style="min-height: 100vh">
		<image class="bg" src="/static/login/log_bg.png" mode="scaleToFill"></image> -->
	<view class="content" :style="{'background':kbackgroundColor}" style="min-height: 100vh">
	
		<hx-navbar title="开盒记录" :back="true" :fixed="false" :color="knavTitleColor" barPlaceholder="hidden" transparent="auto"></hx-navbar>
		<view class="container">
			<view class="compound_item" :style="{border:kborderSty,background:kcellBgColor}"  @tap="see_detail(item.id)" v-for="item,id in list" :key="id">
				<image class="compound_img" :src="item.image" mode="aspectFill"></image>
				<view class="info_box">
					<view class="info_text">
						{{item.goods_name}}
					</view>
					<view class="info_time">
						<text>
							{{item.ctime}}
						</text>
					</view>
				</view>
				<!-- <view class="font-blod">
					抽中{{item.goods_name}}
				</view> -->
			</view>
	<view style="text-align: center;" v-if="list.length == 0">
			 <image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix"></image> 
		<!-- 	<image src="/static/user/none_img2.png" mode="widthFix"></image> -->
		</view>
		</view>
	</view>
</view>
</template>
<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 10,
				hasNextPage: true,
				goods_id: ''
			}
		},
		onLoad(options) {
			this.goods_id = options.goods_id
			if (this.goods_id) {
				this.get_data_list2()
			} else {
				this.get_data_list()
			}

		},
		onReachBottom() {
			if (this.goods_id) {
				this.next_page2()
			} else {
				this.next_page()
			}
		},
		 onPullDownRefresh() {
		 setTimeout(function() {
	 	uni.stopPullDownRefresh()
			 	}, 500)
		 },
		methods: {
			next_page2() {
				let new_page = this.page + 1;
				let data = {
					page: new_page,
					limit: this.limit,
					goods_id: this.goods_id
				}
				this.$api.mangheList(data, res => {
					if (res.status) {
						this.list = this.list.concat(res.data);
						this.hasNextPage = res.data.length >= this.limit;
						this.page = new_page
					}
				})
			},
			get_data_list2: function() {
				let data = {
					page: this.page,
					limit: this.limit,
					goods_id: this.goods_id
				}
				this.$api.mangheList(data, res => {
					if (res.status) {
						this.list = res.data;
						this.hasNextPage = res.data.length >= this.limit;
					}
				})
			},
			next_page() {
				let new_page = this.page + 1;
				let data = {
					page: new_page,
					limit: this.limit
				}
				this.$api.getMangheRecord(data, res => {
					if (res.status) {
						this.list = this.list.concat(res.data);
						this.hasNextPage = res.data.length >= this.limit;
						this.page = new_page
					}
				})
			},
			get_data_list: function() {
				let data = {
					page: this.page,
					limit: this.limit
				}
				this.$api.getMangheRecord(data, res => {
					if (res.status) {
						this.list = res.data;
						this.hasNextPage = res.data.length >= this.limit;
					}
				})
			},
			see_detail: function(id) {
				return;
				uni.navigateTo({
					url: 'compound_page?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.num_box {
		display: flex;
		align-items: center;
		margin-top: 10rpx;

		.num_left {
			width: 70rpx;
			height: 40rpx;
			font-size: 22rpx;
			font-weight: 500;
			line-height: 1;
			color: #fff;
			border-radius: 5rpx 0px 0px 5rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			position: relative;
			z-index: 10;


			background: #F2D7AA;
			opacity: 1;
		}

		.num_right {
			height: 40rpx;
			font-size: 22rpx;
			text-align: center;
			border-radius: 0px 5rpx 5rpx 0px;
			white-space: nowrap;
			opacity: 1;
			padding: 0 10rpx;
			color: #F4E1BC;
			border: 1rpx solid #F4E1BC;
			border-left: none;
		}
	}
</style>

<style lang="scss" scoped>
	.give_userHead {
		width: 50rpx;
		height: 50rpx;
		border-radius: 50%;
		margin-right: 20rpx;
		margin-left: 20rpx;
	}

	.num {
		color: #fff;
	}

	.info_time {
		width: 100%;
		font-size: 20rpx;
		color: #999;
	}

	.info_text {
		font-size: 28rpx;
		color: #000;
		font-weight: 500;
		padding-bottom: 12rpx;
	}

	.info_box {
		flex: 1;
		padding-left: 26rpx;
	}
	.compound_img {
		width: 110rpx;
		height: 110rpx;
		border-radius: 10rpx;
	}

	.compound_item {
		width: 100%;
		height: 138rpx;
		background-color: rgba(255, 255, 255, .5);
		border: 1rpx solid #DCDCDC;
		border-radius: 20rpx;
		padding: 20rpx;
		display: flex;
		align-items: center;
		margin-top: 20rpx;
	}

	.container {
		width: 100%;
		padding: 30rpx 40rpx;
		position: relative;
		z-index: 10;
		& > view:first-child {
			margin-top: 0;
		}
	}
</style>